import request from "@/utils/request";

/**
 * 批量新增电子围栏、更新电子围栏
 * */
export function batch(data) {
  return request({
    url: `/device/polygonPatch/batch`,
    method: "post",
    data,
  });
}

/**
 * 查看电子围栏
 * */
export function queryByLayerIdAndFeatureId(data) {
  data.queryType = 2;
  return request({
    url: `/device/polygonPatch/queryPolygonPatchShow`,
    method: "post",
    data,
  });
}

/**
 * 查询多边形补丁显示批次的函数。
 */
export function queryPolygonPatchShowBatch(data) {
  // 设置查询类型为固定值 2
  data.queryType = 2;
  // 发起 POST 请求，传递修改后的数据对象
  return request({
    url: `/device/polygonPatch/queryPolygonPatchShowBatch`,
    method: "post",
    data,
  });
}

/**
 * 删除电子围栏
 * */
export function deleteByPolygonId(data) {
  return request({
    url: `/device/polygonPatch/delete`,
    method: "post",
    data,
  });
}

/**
 * 查询电子围栏列表
 */
export function queryPolygonList(data) {
  return request({
    url: `/device/polygonPatch/queryList`,
    method: "post",
    data,
  });
}

/**
 * 地图查询图层列表
 */
export function getTenantLayerList(data) {
  return request({
    url: `/bdm/layer/getTenantList`,
    method: "get",
    params: data,
  });
}

/**
 * 根据图层id和图斑id查询图斑显示区域数据
 * @param data
 * @returns {*}
 */
export function queryGeometryById(data) {
  return request({
    url: "/bdm/layerPolygon/info",
    method: "get",
    params: data,
  });
}

/**
 * 查询摄像机详情
 */
export function queryDeviceInfo(data) {
  return request({
    url: "/device/video/device/queryDeviceForWE",
    method: "post",
    data,
  });
}

/**
 * 查询摄像机可视域
 */
export function queryDeviceView(data) {
  return request({
    url: "/device/industry/device/getDeviceModelInfo",
    method: "post",
    data,
  });
}

// 查询电子围栏
export function getPolygonList(data) {
  return request({
    url: "/bdm/inspection/queryPolygonList",
    method: "post",
    data,
  });
}

/**
 * 查电子围栏编号
 */
export function queryMaxNumber(data) {
  return request({
    url: "/device/polygonPatch/queryMaxNumber",
    method: "post",
    data,
  });
}

/**
 * 执行图层空间查询
 * 该函数向GIS服务发送请求，以获取特定图层中的特征数据
 *
 * @param {Object} data - 查询参数对象，包含图层空间查询所需的信息
 */
export function layerParcelQuery(data) {
  return request({
    url: `/gis/getFeatures/layerParcelQuery`,
    method: "post",
    data,
  });
}
